package com.dal;


import javax.servlet.http.HttpServlet;

import com.Bill.BillMainDalzs;
import com.cg.CGMainDal;
import com.hr.HRMainDal;

public class MyServlet extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private Thread thread1;
	private Thread thread2;
	private Thread thread3;
	private HRMainDal hr=new HRMainDal();
	private CGMainDal cg=new CGMainDal();
	private BillMainDalzs bm=new BillMainDalzs();
	
	/**
	 * Constructor of the object.
	 */
	public MyServlet() {
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}
	
	public void init() {
		thread1=new Thread(){
			public void run(){//00000001000300010020
				try {
					while(1>0){
						try {
							cg.sendResult();
							hr.OaInfoTb();
						} catch (Exception e) {
							// TODO: handle exception
						}
						thread1.sleep(1000*60);
					}
					
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		};
		thread1.start();
		
		thread2=new Thread(){
			public void run(){//00000001000300010020
				try {
					while(1>0){
						try {
							hr.HrInfoTb();
						} catch (Exception e) {
							// TODO: handle exception
						}
						thread2.sleep(1000*60*5);
					}
					
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		};
		thread2.start();
		
		thread3=new Thread(){
			public void run(){//00000001000300010020
				try {
					while(1>0){
						try {
							bm.tbBillState();
						} catch (Exception e) {
							// TODO: handle exception
						}
						thread3.sleep(1000*3);
					}
					
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		};
		thread3.start();
	}
}
